﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        enum cq
        {
            石头=1,
            剪刀,
            布
        }
        static void Main(string[] args)
        {
            Console.WriteLine("----- 欢 迎 进 入 游 戏 世 界 ----- ");
            Console.WriteLine("********************");
            Console.WriteLine("*****猜拳，开始*****");
            Console.WriteLine("********************");
            t1();
        }
        static void t1()
        {
            int i = 1;
            NPC npc;
            Console.WriteLine("出拳规则：1、石头 2、剪刀 3、布");
            Console.WriteLine("请输入你的对手：1.刘备 2.孙权 3.曹操");
            int key = int.Parse(Console.ReadLine());
            switch (key)
            {
                case 1:
                    npc = new NPC("刘备");
                    break;
                case 2:
                    npc = new NPC("孙权");
                    break;
                case 3:
                    npc = new NPC("曹操");
                    break;
                default:
                    Console.WriteLine("输入不规范，重新输入！！");
                    t1();
                    break;
            }
            Console.WriteLine("请输入你的名字：");
            string name = Console.ReadLine();
            Figure figure = new Figure(name);

            login:
            Console.WriteLine("{0} vs {1} 对战", figure.name, npc.name);
            figure.print();
            npc.print();
            t2(figure, npc);
            Console.WriteLine("是否下一轮：y/n");
            string key2 = Console.ReadLine();
            switch (key2)
            {
                case "y":
                    i++;
                    goto login;
                    break;
                case "n":
                    Console.WriteLine("{0} vs {1} 对战", figure.name,npc.name);
                    Console.WriteLine("对战次数" + i);
                    Console.WriteLine("名字\t得分");
                    Console.WriteLine("{0}\t{1}", figure.name, figure.score);
                    Console.WriteLine("{0}\t{1}", npc.name, npc.score);
                    if (figure.score >= npc.score)
                    {
                        Console.WriteLine("结果,{0}赢了", figure.name);
                    }
                    else
                    {
                        Console.WriteLine("结果,{0}赢了", npc.name);
                    }
                    Console.WriteLine();

                    Console.WriteLine("要开始下一局吗？<y/n>");
                    string key3 = Console.ReadLine();
                    switch (key3)
                    {
                        case "y":
                            t1();
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }

        private static void t2(Figure figure, NPC npc)
        {
            if (figure.FGG==npc.FGG)
            {
                Console.WriteLine("和局，真哀！ 嘿嘿，等着瞧吧！");
            }
            else if (figure.FGG + 1 == npc.FGG || (figure.FGG == 3 && npc.FGG == 1))
            {
                Console.WriteLine("傻逼，{0}输了", figure.name);
                npc.score++;
            }
            else
            {
                Console.WriteLine("牛逼，{0}赢了", figure.name);
                figure.score++;
            }
        }
    }
}
